<template>
  <view class="wrap">
    <view class="search">
      <u-search v-model="keywords" @custom="search" @search="search"></u-search>
    </view>
    <scroll-view class="scroll-list msg-list-item" scroll-y="true">
      <view v-for="item in data" :key="item.index">
        <view class="msg-time">{{item.createTime}}</view>
<!--        <u-card :title="item.noticeTitle" :sub-title="item.createTime" padding="20" margin="0rpx 20rpx" thumb="/static/aidex/images/list-icon.png" @click="navTo('/pages/sys/msg/form?noticeTitle=' + item.noticeTitle+'&createTime='+item.createTime+'&id='+item.noticeId +'&noticeContent='+item.noticeContent)">-->
        <u-card :title="item.noticeTitle" :sub-title="item.createTime" padding="20" margin="0rpx 20rpx" thumb="/static/aidex/images/list-icon.png" @click="goView(item.noticeId)">
          <view class="" slot="body">
            <view class="u-body-item u-flex u-col-between u-p-t-0">
              <view class="u-body-item-title u-line-2">{{item.noticeContent}}</view>
            </view>
          </view>
          <!--				<view class="" slot="foot"><u-icon name="eye" size="34" color="" label="30"></u-icon> <u-icon name="thumb-up" size="34" color="" label="15"></u-icon></view>-->
        </u-card>
      </view>
      <u-divider>已经到底了</u-divider>
    </scroll-view>
  </view>
</template>
<script>
/**
 * Copyright (c) 2013-Now http://aidex.vip All rights reserved.
 */
export default {
  data() {
    return {
      keywords: '',
      data: []

    };
  },
  onLoad() {

  },
  onShow() {

    this.loadData();


  },


  methods: {

    goView(id){
      console.log(id)
      uni.navigateTo({
        url: '/pages/order/edit?id=' + id
      })
    },
    loadData() {
      this.$u.api.notice.list().then(res => {
        if(res.code == '200'){
          this.data = res.rows;
          console.log(this.data)
        }else{
          this.$u.toast(res.msg);
        }
      });
    },
    navTo(url) {
      uni.navigateTo({
        url: url
      });
    },
    search(value) {
      this.$u.toast('搜索内容为：' + value)
    }

  }
};

</script>
<style lang="scss">
@import '../../../common/uni.css';
page {
  background-color: #f5f5f5;
}
.wrap .search{
  background: #ffffff;
}
.msg-time{
  font-size: 26rpx;
  padding: 10px 0;
  color: #999999;
  text-align: center;
}
.u-card__foot{
  .u-icon{
    margin-right: 10px;
  }
}


</style>
